

import 'package:flutter/cupertino.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:gczn_hd/app/core/values/app_values.dart';
import 'package:gczn_hd/app/core/values/text_styles.dart';
import 'package:gczn_hd/app/core/widget/custom_title_bar.dart';

class checkOrderMsg extends StatelessWidget{


@override
  Widget build(BuildContext context) {
    return Column(
      children: [
        CustomTitleBar(title: "检验信息", handleBtn: Container(
          child: Text("待审核", style: toggleStyle('待审核')),),
        ),
        SizedBox(height: AppValues.size30.h,),
        _buildMessage()
      ],
    );
  }


    Widget _buildMessage(){
      List<Map<String, String>> list = [
        {"label": "任务单号", "value": "JY20250001"},
        {"label": "工序名称", "value": "注塑"},
        {"label": "产品名称", "value": "格力空气循环落地风扇"},
        {"label": "检验单号", "value": "172128"},
        {"label": "检验类型", "value": "巡检"},
        {"label": "检验时间", "value": "2024-2-28 19:42:51"},
        {"label": "检验数量", "value": "100"},
        {"label": "不良品数", "value": "2"},

      ];

      return Column(
        children: list.map((item) => _buildMessageItem(item)).toList(),
      );

    }
     Widget _buildMessageItem(Map<String, String> map){
    return Container(
      margin: EdgeInsets.only(bottom: AppValues.size20.h),
      child: Row(
        children: [
          SizedBox(
            width: AppValues.size108.w,
            child: Text(map["label"]!, style: textStyle20Opa8,),
          ),
          SizedBox(width: AppValues.size20.w,),
          Expanded(
            flex: 1,
            child: Text(map["value"]!, style: textStyle,),
          )
        ]
      )
    );
  }



  TextStyle toggleStyle(String text){
    if( text == '待检验' ) {
      return waitTextStyle;
    } else if( text == '待审核' ) {
      return fialTextStyle;
    } else {
      return  successTextStyle;
    }
  }

}